package com.syedu.util;

import java.util.Scanner;

/**
 * description：键盘输入工具类
 * @author Administrator
 * @date 2022/3/9 16:26
 */
public class InputUtil {
    /**
     * 接收用户输入的整数
     */
    public static int getInt(String hint){
        Scanner scanner = new Scanner(System.in);
        System.out.print(hint);
        return scanner.nextInt();
    }

    /**
     * 接收用户输入的浮点数
     */
    public static double getDouble(String hint){
        Scanner scanner = new Scanner(System.in);
        System.out.print(hint);
        return scanner.nextDouble();
    }

    /**
     * 接收用户输入的长整型
     */
    public static long getLong(String hint){
        Scanner scanner = new Scanner(System.in);
        System.out.print(hint);
        return scanner.nextLong();
    }

    /**
     * 接收用户输入的字符串
     */
    public static String getStr(String hint){
        Scanner scanner = new Scanner(System.in);
        System.out.print(hint);
        return scanner.next();
    }

    public static String getStrLine(String hint){
        Scanner scanner = new Scanner(System.in);
        System.out.print(hint);
        return scanner.nextLine();
    }
}